package com.xbh.realtime.tio.srv;

import com.jfinal.plugin.redis.Redis;
import com.xbh.realtime.tio.websocket.MyWSConfig;
import org.tio.core.ChannelContext;
import org.tio.core.Tio;
import org.tio.websocket.common.WsResponse;
import redis.clients.jedis.Jedis;

import java.util.Map;

/**
 * @NotHelloAsyncSolver: 非hello 消息 处理器
 * @author: ZBoHang
 * @time: 2021/8/11 11:00
 */
public class NotHelloAsyncSolver implements Runnable {

    private String msg;

    public NotHelloAsyncSolver(String msg) {

        this.msg = msg;
    }


    @Override
    public void run() {

        Jedis jedis = null;
        try {
             jedis = Redis.use("messageQueue").getJedis();
             jedis.publish("myChannel", msg);
        } catch (Exception e) {
            throw e;
        } finally {
            if (jedis != null) {
                jedis.close();
            }
        }
    }
}
